﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;
using Microsoft.Advertising.Mobile.UI;
using Common.Library;
using OnlineVideos.UI;
using Common.Utilities;


namespace OnlineVideos
{
    public partial class AboutMemory : PhoneApplicationPage
    {
        #region GlobalDeclaration

        private SolidColorBrush adcontrolborder = new SolidColorBrush(Colors.Transparent);
        #endregion

        #region Constructor

        public AboutMemory()
        {
            InitializeComponent();
        }

        #endregion
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            try
            {
                FlurryWP8SDK.Api.LogPageView();
            }
            catch (Exception ex)
            {

               Exceptions.SaveOrSendExceptions("Exception in OnNavigatedTo Method In AboutMemory.cs file.", ex);
            }
        }
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            try
            {
                FlurryWP8SDK.Api.EndTimedEvent("AboutMemory Page");
            }
            catch (Exception ex)
            {
                
               Exceptions.SaveOrSendExceptions("Exception in OnNavigatedFrom Method In AboutMemory.cs file.", ex);
            }
        }
        #region PageLoad

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            LoadAds();
           
               
            try
            {
                FlurryWP8SDK.Api.LogEvent("AboutMemory Page", true);
            Version.Text = System.Reflection.Assembly.GetExecutingAssembly().FullName.Split('=')[1].Split(',')[0];
            txtNetworktype.Text = NetworkInterface.NetworkInterfaceType.ToString();
            txtmemoryUsage.Text = (Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage / 1048576).ToString();
            txtpeakmemoryUsage.Text = (Microsoft.Phone.Info.DeviceStatus.ApplicationPeakMemoryUsage / 1048576).ToString();
            txtdevicetotalmemory.Text = (Microsoft.Phone.Info.DeviceStatus.DeviceTotalMemory / 1048576).ToString();
        }
            catch (Exception ex)
            {
                
                Exceptions.SaveOrSendExceptions("Exception in PhoneApplicationPage_Loaded Method In AboutMemory.cs file.", ex);
            }
        }
        #endregion

        #region "Common Methods"

        private void LoadAds()
        {
            try
            {
                PageHelper.LoadAdControl(LayoutRoot, adstackpl, 2);
            }
            catch (Exception ex)
            {
                Exceptions.SaveOrSendExceptions("Exception in LoadAds Method In SongDetails file", ex);
                string excepmess = "Exception in LoadAds Method In SongDetails file.\n\n" + ex.Message + "\n\n StackTrace :- \n" + ex.StackTrace;
            }
        
        }
       
        #endregion

        #region Events

        private void btnagentlog_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(NavigationHelper.BackAgentErrorPage);
        }

        private void imgTitle_MouseEnter(object sender, MouseButtonEventArgs e)
        {
            NavigationService.Navigate(NavigationHelper.MainPanoramaPage);
        }
        #endregion
    }
}